//
//  NSDictionary+String2Dict.m
//  BJMap
//
//  Created by  on 2020/7/8.
//  Copyright © 2020 DC. All rights reserved.
//

#import "NSDictionary+String2Dict.h"


@implementation NSDictionary (String2Dict)
+(instancetype)dictionaryWithJsonString:(NSString *)jsonString{
    NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    if (data) {
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        if (dict) {
            return dict;
        }
    }
    return @{};
}
+(NSArray *)arrWithJsonString:(NSString *)jsonString{
    NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
       if (data) {
           NSArray *arr = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
           if (arr) {
               return arr;
           }
       }
       return @[];
}
@end
